from peewee import *

database = SqliteDatabase('db.sqlite3',timeout=10000,pragmas={
    'journal_mode': 'wal',
    'cache_size': -1024 * 64,
    'busy_timeout': 10000000,


})



class BaseModel(Model):
    class Meta:
        database = database


class Up(BaseModel):
    active = IntegerField(null=True)
    fans = TextField(null=True)
    fans_num = IntegerField(null=True)
    id = CharField(primary_key=True)
    image = CharField(null=True)
    inactivate_nums = IntegerField(null=True)
    name = CharField(null=True)
    url = CharField(null=True)

    class Meta:
        table_name = 'up'

class Video(BaseModel):
    date = TextField(null=True)
    id = CharField(primary_key=True)
    image = TextField(null=True)
    name = CharField(null=True)
    time = IntegerField(null=True)
    upid = CharField(null=True)
    url = TextField(null=True)

    class Meta:
        table_name = 'video'

class VideoData(BaseModel):
    collections = IntegerField(null=True)
    date = TextField(null=True)
    likes = IntegerField(null=True)
    shares = IntegerField(null=True)
    time = IntegerField(null=True)
    videoid = CharField()
    views = IntegerField(null=True)

    class Meta:
        table_name = 'video_data'
